Accusoft.PdfXpress5.ActiveX
Extract Images
Send Feedback
PDF Xpress 5 for ActiveX - User Guide > How To > Extract Images

Glossary Item Box

PDF Xpress™ supports extracting images from a PDF Page.

The following is an example in which a PDF document is opened and an image on each page is then accessed. You can then save to disk, pass the image data to ImagXpress for compression, etc.

VB 6 Copy Code
Option Explicit
Dim pdf As PdfXpress
Private Sub Command1_Click()
    pdf.Initialize
    
    Dim doc As New PdfDocument
    doc.SetParentControl pdf
    doc.OpenDocument "document.pdf", ""
    Dim pageNumber As Long
    Dim extractOptions As ExtractImageOptions
    
    For pageNumber = 0 To doc.DocumentPageCount - 1
        Dim imageCount As Long
        imageCount = doc.ExtractImages(pageNumber, extractOptions)
        
        Dim imageIndex As Integer
        For imageIndex = 0 To imageCount - 1
            Dim image As New PdfImage
            Set image = doc.GetExtractedImage(pageNumber, imageIndex)
                        
            'work with the image data here, e.g., save to disk...
        Next imageIndex
    Next pageNumber
End Sub
©2012. Accusoft Corporation. All Rights Reserved.